// 简单的编译测试
use std::sync::Arc;
use tokio::sync::Mutex;

#[derive(Debug, Clone)]
struct TestState {
    pub details: Vec<String>,
}

impl TestState {
    fn new() -> Self {
        Self {
            details: Vec::new(),
        }
    }

    fn add_detail(&mut self, detail: String) {
        self.details.push(detail);
    }
}

#[tokio::main]
async fn main() {
    println!("开始编译测试");
    
    // 测试基本的Arc和Mutex
    let state = Arc::new(Mutex::new(TestState::new()));
    
    // 模拟transaction_controller.rs中的闭包使用模式
    let test_fn = {
        let state = state.clone();
        async move {
            let mut state_guard = state.lock().await;
            state_guard.add_detail("测试成功".to_string());
            Ok::<(), String>(())
        }
    };
    
    match test_fn.await {
        Ok(()) => println!("测试通过"),
        Err(e) => println!("测试失败: {}", e),
    }
} 